import {useSelector} from "react-redux"
import { Navigate } from 'react-router-dom';
import { IUserStore } from '../interface/IStore';

export default function RouterEnter(props:Readonly<{children:any}>) {
  const {user}=useSelector((state:{user:IUserStore})=>{
    return state.user;
  });
  if(!user.token) return <Navigate to={"/login"}/>

  
  return props.children
}
